﻿/*
 * @author: wizardc
 */

using System;
using UnityEngine;
using Object = UnityEngine.Object;

namespace Dou.Resource
{
    /// <summary>
    /// 资源加载接口
    /// </summary>
    interface IAssetLoader
    {
        int maxLoadABThread { set; get; }
        
        int maxLoadAssetThread { set; get; }

        void Init(bool isEncrypt, Action onComplete, AssetUnloadSetting[] unloadSettings);

        void LoadAssetBundle(string name, Action<AssetBundle> onComplete, int priority);

        void LoadAssetBundleSync(string name, Action<AssetBundle> onComplete, int priority);

        AssetBundle GetAssetBundle(string name);
        
        void UnloadAssetBundle(string name, bool force);

        void AddRef(string abName, int count = 1);

        void DecRef(string abName, int count = 1);
        
        void AddAssetRef(string assetName, int count = 1);

        void DecAssetRef(string assetName, int count = 1);

        void LoadAsset(string name, Type type, Action<Object> onComplete, int priority);

        void LoadAssetSync(string name, Type type, Action<Object> onComplete, int priority);
        
        void UnloadAsset(string name);
        
        void LoadPrefab(string name, Action<GameObject> onComplete, int priority);

        void LoadPrefabSync(string name, Action<GameObject> onComplete, int priority);

        void UnloadUnusedAB();
        
        string GetAssetBundleName(string name);
        
        string GetAssetFullPath(string name);
        
        string GetRawAssetPath(string name);
    }
}
